<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>报名等待</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name="apple-mobile-web-app-status-bar-style" content="default"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta name="format-detection" content="telephone=no"/>

    <link href="${s.base}/mobile/css/weui.min.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/jquery-weui.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/swiper.min.css" rel="stylesheet">
    <link href="${s.base}/mobile/css/reset.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/weChat.css" rel="stylesheet">
    <link href="${s.base}/mobile/css/association/association.css" rel="stylesheet">
</head>
<body>
    <!--<h2 id="show">已在队列中，等待处理</h2>-->
    <div class="load-ctn">
        <div class="load-ctn-nei">
            <div class="load-mid-cont" id="waitShow">
                <div class="load-img"><img src="${s.base}/mobile/images/association/load.gif"></div>
                <div class="load-txt1">小e正在努力帮您争取名额中，请耐心等待！</div>
            </div>
            <div class="load-mid-cont" id="successShow" style="display:none;">
                <div class="load-img2" ><img src="${s.base}/mobile/images/association/cg.jpg"></div>
                <div class="load-txt2">报名成功！</div>
                <div class="load-btn" onclick="backBtn();">返回上一页</div>
            </div>
            <div class="load-mid-cont" id="failShow" style="display:none;"4444>
                <div class="load-img2" ><img src="${s.base}/mobile/images/association/bmsb.jpg"></div>
                <div class="load-txt2">您的手速慢了哟，名额已满，再去看看其他有趣的社团吧！</div>
                <div class="load-btn" onclick="backBtn();">返回上一页</div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/fontSize.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-weui.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/fastclick.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
<script>
    // 通过轮询加载数据，如果
    var eduToken = '${eduToken}';
    var signId = '${signId}';
    var associationNewId = '${associationNewId}';
    var associationNewDetailId = '${associationNewDetailId}';
    var count = 1;

    function showUnreadNews() {
        $.fn.doPost('/phone/associationnew/getAssociationBySignId', {
            signId: signId,
            associationNewId: associationNewId,
            associationNewDetailId: associationNewDetailId,
            eduToken: eduToken
        }, function (result) {
            // 转圈，如果报名成功提醒
            if (result.code === 0) {
                // 报名成功
                clearInterval(interval );//停止
                $("#waitShow").hide();
                $("#failShow").hide();
                $("#successShow").show();
            } else if (result.code === 1) {
                // 失败，直接跳转页面，重新报名
                clearInterval(interval );//停止
                $("#waitShow").hide();
                $("#failShow").show();
                $("#successShow").hide();
            } else if (result.code === 10) {
                // 继续等待轮询
                // $.toast(result.msg, "text");
                console.log("已轮询次数："+count++)
            }
        });
    }
    //轮询执行，2000ms一次
    var interval = setInterval('showUnreadNews()', 2000);

    function backBtn(){
        var url = '/phone/associationnew/associationDetail?token=${token}&applyId=${applyId}&type=1&associationId=${associationId}&associationNewId=${associationNewId}&eduToken=${eduToken}&associationNewDetailId=${associationNewDetailId}';
        window.location.href = url;
    }
</script>
</html>

